package com.example;

import java.util.Scanner;

/**
 * @Author: 胡成
 * @Version: 0.0.1V
 * @Date: 2019/2/25
 * @Description: 返回最长的对称数
 **/
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        System.out.println(result(s));
    }

    /**
     * 返回最长的对称数
     */
    public static String result(String s) {
        String result1 = "";
        for (int j = 0; j <= s.length(); j++) {
            for (int i = 0; i <= s.length(); i++) {
                if (i + j <= s.length()) {
                    String ss = s.substring(i, i + j);
                    if (fun(ss)) {
                        result1 = ss;
                    }
                }
            }
        }
        if (result1.length() > 1) {
            return result1;
        } else {
            return s;
        }
    }

    /**
     * 返回是否是回文数
     */
    public static boolean fun(String n) {
        String s = n;
        String k = "";
        for (int j = s.length() - 1; j >= 0; j--) {
            k += s.charAt(j);
        }
        if (k.equals(s)) {
            return true;
        }
        return false;
    }
}
